var { successData, errorData } = require('../serverData')
const login = (req, res) => { 
    const { username, password } = req.body
    var data = {}
    if(username === 'admin' && password === 'admin'){
        successData.data = {
            id:0,
            name:'admin',
            password:'admin',
            token: new Date().getTime()
        }
        data = Object.assign({},successData);
    }else{
        data = Object.assign({},errorData);
    }
    res.end(JSON.stringify(data));
}

module.exports = login